﻿using AnQinFrameWorkAPI.Entity.Develop.DTO.DevelopProjectImplement;
using AnQinFrameWorkAPI.Entity.Develop.View.DevelopProjectDevelopment;
using AnQinFrameWorkAPI.Entity.Develop.View.DevelopProjectImplement;
using AnQinFrameWorkAPI.Service.Develop;
using FrameWork.Entity;
using Microsoft.AspNetCore.Mvc;

namespace AnQinFrameWorkAPI.Controllers.Develop;

/// <summary>
///     开发管理项目实施
/// </summary>
[Route("api/[controller]")]
[ApiController]
[ApiExplorerSettings(GroupName = "Develop")]
public class DevelopProjectImplementController : ControllerBase
{
    //业务服务接口
    private readonly DevelopProjectImplementService _developProjectImplementService;

    //构造注入
    public DevelopProjectImplementController(DevelopProjectImplementService developProjectImplementService)
    {
        _developProjectImplementService = developProjectImplementService;
    }

    /// <summary>
    ///     获取开发管理项目实施列表
    /// </summary>
    /// <param name="developProjectImplementSearchDTO"></param>
    [ProducesResponseType(typeof(DevelopProjectDevelopmentView), 200)]
    [HttpGet]
    public async Task<IActionResult> GetProjectDevelopment(
        [FromQuery] DevelopProjectImplementSearchDTO developProjectImplementSearchDTO)
    {
        var response = await _developProjectImplementService.GetProjectImplement(developProjectImplementSearchDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目实施 - 开始实施
    /// </summary>
    /// <param name="singleIdDTO"></param>
    [HttpPost("Start")]
    public async Task<IActionResult> StartDevelopProjectDevelopment([FromBody] SingleIdDTO singleIdDTO)
    {
        var response = await _developProjectImplementService.StartDevelopProjectImplement(singleIdDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目实施 - 结束实施
    /// </summary>
    /// <param name="singleIdDTO"></param>
    [HttpPost("Finish")]
    public async Task<IActionResult> FinishDevelopProjectDevelopment([FromBody] SingleIdDTO singleIdDTO)
    {
        var response = await _developProjectImplementService.FinishDevelopProjectImplement(singleIdDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     获取开发管理项目实施需求列表
    /// </summary>
    /// <param name="developProjectDemandImplementSearchDTO"></param>
    [ProducesResponseType(typeof(DevelopProjectDemandImplementView), 200)]
    [HttpGet("Demand")]
    public async Task<IActionResult> GetProjectImplementDemand(
        [FromQuery] DevelopProjectDemandImplementSearchDTO developProjectDemandImplementSearchDTO)
    {
        var response =
            await _developProjectImplementService.GetProjectImplementDemand(developProjectDemandImplementSearchDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目需求实施 - 测试
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("TestMulti")]
    public async Task<IActionResult> TestArrayDevelopProjectDemandImplement([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectImplementService.TestArrayDevelopProjectDemandImplement(idArrayDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目需求实施 - 发布
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("ReleaseMulti")]
    public async Task<IActionResult> ReleaseArrayDevelopProjectDemandImplement([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectImplementService.ReleaseArrayDevelopProjectDemandImplement(idArrayDTO);
        return StatusCode(response.Status, response);
    }

    /// <summary>
    ///     开发管理项目需求实施 - 完成
    /// </summary>
    /// <param name="idArrayDTO"></param>
    [HttpPost("FinishMulti")]
    public async Task<IActionResult> FinishArrayDevelopProjectDemandImplement([FromBody] IdArrayDTO idArrayDTO)
    {
        var response = await _developProjectImplementService.FinishArrayDevelopProjectDemandImplement(idArrayDTO);
        return StatusCode(response.Status, response);
    }
}